package com.frxuexi.video

import android.view.View
import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.lib_base.entity.Comment
import com.frxuexi.lib_base.entity.CommentBeanItem
import com.frxuexi.lib_base.entity.VideoBeanItem
import com.frxuexi.lib_base.entity.VisitBeanItem
import com.frxuexi.lib_base.utils.GlideUtil
import com.frxuexi.video.databinding.ItemCommentBinding

class CommentAdapter:BaseQuickAdapter<Comment,BaseViewHolder>(R.layout.item_comment) {

    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
        DataBindingUtil.bind<ItemCommentBinding>(viewHolder.itemView)
    }
    override fun convert(helper: BaseViewHolder, item: Comment) {
        val binding = DataBindingUtil.getBinding<ItemCommentBinding>(helper.itemView)!!

        binding.commAuthor.setText(item.nickname.toString())
        GlideUtil.getCircleImg(item.userlogo,binding.commImg)
        binding.commTime.text=item.createtime
        binding.commContent.text=item.content
        binding.commNum.text=item.zanNum.toString()
        binding.commZan.apply {
            if(item.isZan){
                binding.commZan.setImageResource(R.drawable.ic_xihuanred)
            }else{
                binding.commZan.setImageResource(R.drawable.ic_action_nolove)
            }
        }
    }

}